package com.ejuornal.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public final class SpringTestUtill {
    /**
     * 加载Spring的applicationContext.xml配置文件，获得dataSource
     */
    private static ApplicationContext ctx = new ClassPathXmlApplicationContext(
            "applicationContext.xml");

    /**
     * 传入applicationContext.xml文件中id的值，返回Object类型对象
     * @param beanName 要得到的对象
     * @return
     */
    public static Object getBean(String beanName) {
        return ctx.getBean(beanName);
    }
}
